package com.example.beatbox;

import android.view.View;

import com.example.beatbox.databinding.ListItemSoundBinding;

import androidx.recyclerview.widget.RecyclerView;

public class SoundHolder extends RecyclerView.ViewHolder {

    private ListItemSoundBinding mListItemSoundBinding;

    public SoundHolder(ListItemSoundBinding binding, BeatBox beatBox) {
        super(binding.getRoot());
        mListItemSoundBinding = binding;
        mListItemSoundBinding.setViewModel(new SoundViewModel(beatBox));
    }

    public void bind(Sound sound){
        mListItemSoundBinding.getViewModel().setSound(sound);
        mListItemSoundBinding.executePendingBindings();
    }
}
